enyo.kind({
	name: "webFTP.Configs",
	kind: enyo.VFlexBox,
	events: {
		onSave: "",
		onCancel: ""
	},
	components: [
		{
		    name: "db",
		    kind: "onecrayon.Database",
		    database: 'ext:HostsDatabase',
		    version: "",
		    debug: false
		},
		{name: "config", kind:"VFlexBox", flex:1, components: [
			{kind: "Header", content:"Configuration"},
		    {kind: "RowGroup", name: "hostRowID" ,caption: "Row ID", components: [ 
				{name:"hostItemID", kind: "Input"}
			]},
			{kind: "RowGroup", caption: "Title", components: [ 
				{name:"hostTitleInput", kind: "Input"}
			]},
			{kind: "RowGroup", caption: "Host Name", components: [ 
				{name:"hostNameInput", kind: "Input", hint: "Enter the Host or IP:", components: [
					{kind: "ListSelector",
					name: "hostTypeSelector",
					value: "FTP",
					items: [
						{caption: "FTP"},
						{caption: "SFTP"}
					]}
				]}
			]},
			{kind: "RowGroup", caption: "Port Number", components: [ 
				{name:"hostPortInput", kind: "Input"}
			]},
			{kind:"HFlexBox", pack: "center", style: "padding: 0 10px;",
				components: [
					{name: "doneButton", kind: "Button", content: "Done", onclick: "doneClick"},
					{width: "10px"},
					{name: "cancelButton", kind: "Button", content: "Cancel", onclick: "cancelClick"}
				]					
			}
		]}
	],
	create: function() {
		this.inherited(arguments);
		//dunno how to do this yet.
		
		this.ResultsData = [];
		this.log("Config Create Fired.");
	},
	cancelClick: function() {
		this.doCancel();
	},
	doneClick: function() {
		
	},
	
	/**
	 * Setup method necessary for configuring a Host
	 *
	 * Parameters:
	 * - hostID (object, required): where the key is the table field and the value is it's value
	 * 
	 */
	configHost: function(inHost) {
		// Parse the hostID object if we have one
		if (typeof inHost !== 'undefined') {
			for (var key in inHost) {
				switch (key) {
				case "rowID":
					this.$.hostItemID.setValue(inHost[key]);
					this.$.hostRowID.hide();
					break;
				case "title":
					this.$.hostTitleInput.setValue(inHost[key]);
					break;
				case "host":
					this.$.hostNameInput.setValue(inHost[key]);
					break;
				case "port":
					this.$.hostPortInput.setValue(inHost[key]);
					break;
				case "type":
					this.$.hostTypeSelector.setValue(inHost[key]);
					break;
				default:
					this.warn("Unhandled Field: (" + key + ") with value of (" + inHost[key] + ").")
				};
			}
		}
	}
});